-
Notifications
You must be signed in to change notification settings - Fork 712
[JENKINS-74907] Add validations when Jenkins is in FIPS mode #1010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Required to have access to jenkins.security.FIPS140
I'm fixing the unit test |
It's not possible to tests this because of non-compliant dependencies. So I'm moving this PR to draft. |
# Conflicts: # pom.xml # src/main/java/hudson/plugins/ec2/EC2Cloud.java # src/main/java/hudson/plugins/ec2/WindowsData.java # src/main/java/hudson/plugins/ec2/ssh/verifiers/HostKey.java # src/main/java/hudson/plugins/ec2/win/WinConnection.java # src/main/java/hudson/plugins/ec2/win/winrm/WinRMClient.java # src/main/resources/hudson/plugins/ec2/Messages.properties
try { | ||
FIPS140Utils.ensureNoPasswordLeak(useHTTPS, password); | ||
} catch (IllegalArgumentException e) { | ||
throw new Descriptor.FormException(e, "password"); | ||
} | ||
try { | ||
FIPS140Utils.ensureNoSelfSignedCertificate(allowSelfSignedCertificate); | ||
} catch (IllegalArgumentException e) { | ||
throw new Descriptor.FormException(e, "allowSelfSignedCertificate"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be no check on the password length here if a password is in used? Also should the checks only take place if specifyPassword
is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added: bac89fb (see next commit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added: 93c5a3c
Moved to draft to avoid merging that before https://issues.jenkins.io/browse/JENKINS-75187 is fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Test(expected = IllegalArgumentException.class) | ||
public void testSelfSignedCertificateNotAllowed() throws MalformedURLException { | ||
new WinRMClient(new URL("https://localhost"), "username", "password", true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT, the modern way of testing an expected exception is assertThrows(Throwable.class, () -> ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: 22bda8f
PR to improve plugin's FIPS compliance. All the checks are centralized in
FIPS140Utils
to ensure consistency of error messages.Bump of Jenkins is required to have access to
FIPS140.useCompliantAlgorithms()
Testing done
See added unit tests. Here is also screenshots from the form validation:
Submitter checklist
Link to relevant pull requests, esp. upstream and downstream changes